package Controller;

import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

import static com.sun.activation.registries.LogSupport.log;

@RestController
@Log4j2
public class ServiceConsumerController {
    @Resource
    private RestTemplate restTemplate;
    @Value("${service-url.nacos-user-service}")
    private String providerUrl;

    @GetMapping("/consumer/hello")
    public String hello() {
        log("goto consumer hello()");
        return restTemplate.getForObject(providerUrl+"/provider/hello", String.class);
    }
}
